﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using bt1.DTO;
using System.Data;

namespace bt1.DAO
{
    public class SanPhamDAO
    {
        public void ThemSanPham(SanPhamDTO item)
        {
            string sqlQuery = String.Format(
                "INSERT INTO [sanpham] ([ten],[gia],[soluongton]) VALUES ( '{0}' , {1}, {2})",
                item.Ten,
                item.Gia,
                item.SoLuongTon
            );
            DataProvider _dataProvider = new DataProvider();
            _dataProvider.ExecuteQuery(sqlQuery);
        }

        public DataTable LayDS()
        {
            string sqlQuery = "select * from sanpham";
            DataProvider _dataProvider = new DataProvider();
            DataTable tb = _dataProvider.ExecuteQuery(sqlQuery);
            return tb;
        }
    }
}
